﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using NHibernate;
using FluentNHibernate.Data;

namespace BankCreditPortfolio.DAL.Entities
{
    public class Payment
    {
        public virtual int PaymentId { get; set; }
        public virtual decimal Amount { get; set; }
        public virtual Currency Currency { get; set; }
        public virtual PaymentStatus PaymentStatus { get; set; }
        public virtual Deposit Deposit { get; set; }
        public virtual DateTime Date { get; set; }
    }

    public class PaymentMap : ClassMap<Payment>
    {
        public PaymentMap()
        {
            Id(x => x.PaymentId).GeneratedBy.HiLo("Payment");
            Id(x => x.PaymentId).Unique();
            Map(x => x.Amount);
            Map(x => x.Date);
            References(x => x.Currency).Column("CurrencyId");
            References(x => x.PaymentStatus).Column("PaymentStatusId");
            References(x => x.Deposit).Column("DepositId");
            Table("Payment");
        }
    }
}
